#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 25010;

int a[N];
bool f[N];

int main() {
    int T;
    cin >> T;
    
    while (T -- ) {
        int n;
        cin >> n;
        
        for (int i = 0; i < n; ++ i) scanf("%d", a + i);
        
        sort(a, a + n);
        int m = a[n - 1], cnt = 0;
        
        memset(f, 0, sizeof f);
        f[0] = 1;
        for (int i = 0; i < n; ++ i) {
            if (!f[a[i]]) cnt ++ ;
            for (int j = a[i]; j <= m; ++ j)
                f[j] += f[j - a[i]];
        }
        
        cout << cnt << endl;
    }
    
    return 0;
}